RunAs

您所在的位置:网站首页 runas user RunAs

RunAs

2023-04-13 03:43| 来源: 网络整理| 查看: 265

RunAs

Specifies a set of user credentials to use for all subsequent uses of Run and RunWait.

RunAs User, Password, Domain Parameters User

Type: String

If this and the other parameters are all omitted, the RunAs feature will be turned off, which restores Run and RunWait to their default behavior. Otherwise, this is the username under which new processes will be created.

Password

Type: String

User's password.

Domain

Type: String

User's domain. To use a local account, leave this blank. If that fails to work, try using @YourComputerName.

Remarks

If the script is running with restricted privileges due to User Account Control (UAC), any programs it launches will typically also be restricted, even if RunAs is used. To elevate a process, use Run *RunAs instead.

This function does nothing other than notify AutoHotkey to use (or not use) alternate user credentials for all subsequent uses of Run and RunWait. The credentials are not validated by this function.

If an invalid User, Password, or Domain is specified, Run and RunWait will display an error message explaining the problem (unless this error is caught by a Try/Catch statement).

While the RunAs feature is in effect, Run and RunWait will not able to launch documents, URLs, or system verbs. In other words, the file to be launched must be an executable file.

The "Secondary Logon" service must be set to manual or automatic for this function to work (the OS should automatically start it upon demand if set to manual).

Related

Run, RunWait

Examples

Opens the registry editor as administrator.

RunAs "Administrator", "MyPassword" Run "RegEdit.exe" RunAs ; Reset to normal behavior.


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3